import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import pinia from './stores'
import i18n from './locales'

// 引入全局样式
import './assets/styles/index.scss'

// 引入Ant Design Vue
import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/reset.css'

// 引入SVG图标
import 'virtual:svg-icons-register'
import { setupSvgIcon } from './plugins/svgIcon'
import { setupIcons } from './plugins/icons'

// 引入自定义指令
import { setupDirectives } from './directives'

// 创建应用实例
const app = createApp(App)

// 注册全局组件和插件
app.use(router)
app.use(pinia)
app.use(i18n)
app.use(Antd)

// 注册全局函数
import { t } from '@/composables/useGlobalI18n'
app.config.globalProperties.$t = t

// 配置SVG图标
setupSvgIcon(app)
// 配置Ant Design Vue图标
setupIcons(app)

// 注册自定义指令
setupDirectives(app)

// 挂载应用
app.mount('#app')
